package com.santu.edu.supporter.exception;


/**
 * @author luoyaoqi
 * @createTime 2023/4/25
 * @description
 */
public enum CustomError implements BizError {
    /**
     * 数据库异常
     */
    NOT_LOGIN(10001, "用户未登录"),
    COMMON_ERROR(0, ""),
    REQUEST_ERROR(10002, "请求出错"),
    ENUM_CONVERT_ERROR(10003, "枚举类转换异常"),
    ORDER_NOT_EXIST(10004, "订单不存在"),

    ORDER_NOT_CANCEL(10005,"订单不能取消"),

    ORDER_NOT_COMPLETE(10006,"订单不能完成"),

    GOOD_NOT_ENOUGH(100000,"商品库存不足"),


    ;


    private int code;

    private String desc;

    CustomError(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getDesc() {
        return this.desc;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static CustomError createCustomError(int code, String desc) {
        COMMON_ERROR.setCode(code);
        COMMON_ERROR.setDesc(desc);
        return COMMON_ERROR;
    }
}
